import request from '@/utils/request.js'

const api_name = '/copyrightin/chapter'

export default {
  // 带分页的条件查询
  query(pageNo, pageSize, chapterQuery) {
    // 调用后端接口 axios发出异步请求
    return request({
      url: `${api_name}/${pageNo}/${pageSize}`,
      method: 'post',
      data: chapterQuery
    })
  },
  // 修改
  update(chapter) {
    return request({
      url: `${api_name}/updateChapter`,
      method: 'put',
      data: chapter
    })
  },
  // 回显
  view(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  delete(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'delete'
    })
  },
  upOrDownChapter(id, status) {
    return request({
      url: `${api_name}/upOrDownChapter/${id}/${status}`,
      method: 'put'
    })
  }
}

